import Vue from "vue";
import Router from "vue-router";
Vue.use(Router);

export default new Router({
    //路由模式为history
    mode: "history",
    base: process.env.BASE_URL,
    routes: [
        {
            path: "/",
            redirect: "/charts"
        },
        {
            path: "/zspParent",
            name: "zspParent",
            component: () => import("./views/zspParent.vue")
        },
        {
            path: "/img",
            name: "img",
            component: () => import("./views/img.vue")
        },
        {
            path: "/directives",
            name: "directives",
            component: () => import("./views/directives.vue")
        },
        {
            path: "/charts",
            name: "charts",
            component: () => import("./views/charts.vue")
        },
        {
            path: "/zsp_ui",
            name: "zsp_ui",
            component: () => import("./views/zsp_ui.vue")
        },
        {
            path: "/home",
            name: "home",
            component: () => import("./views/Home.vue")
        },
        {
            path: "/mint",
            name: "mint",
            component: () => import("./views/mint.vue")
        },
        {
            path: "/detail",
            name: "detail",
            component: () => import("./views/detail.vue")
        },
        {
            path: "/getHttpRequest",
            name: "getHttpRequest",
            component: () => import("./views/getHttpRequest.vue")
        },
        {
            path: "/weuiJS",
            name: "weuiJS",
            component: () => import("./views/weuiJS.vue")
        },
        {
            path: "/less01",
            name: "less01",
            component: () => import("./views/less01.vue")
        },
        {
            path: "/getDom",
            name: "getDom",
            component: () => import("./views/getDom.vue")
        },
        {
            path: "/weui-components",
            name: "weui-components",
            component: () => import("./views/weui-components.vue")
        },
        {
            path: "/ele",
            name: "ele",
            component: () => import("./views/ele.vue")
        },
        {
            path: "/controlShowAndHide",
            name: "controlShowAndHide",
            component: () => import("./views/controlShowAndHide.vue")
        },
        {
            path: "/form11",
            name: "form11",
            component: () => import("./views/form11")
        },
        {
            path: "/props",
            name: "props",
            component: () => import("./views/props")
        },
        {
            path: "/applyTransition",
            name: "applyTransition",
            component: () => import("./views/applyTransition")
        },
        {
            path: "/globalDataTest",
            name: "globalDataTest",
            component: () => import("./views/globalDataTest")
        },
        {
            path: "/filtersTest",
            name: "filtersTest",
            component: () => import("./views/filtersTest")
        },
        {
            path: "/parent",
            name: "parent",
            component: () => import("./views/parent"),
            redirect: "/parent/child1",
            children: [
                {
                    path: "child1",
                    name: "child1",
                    component: () => import("./views/parent/child1")
                },
                {
                    path: "child2",
                    name: "child2",
                    component: () => import("./views/parent/child2")
                },
                {
                    path: "child3",
                    name: "child3",
                    component: () => import("./views/parent/child3")
                }
            ]
        },
        {
            path: "*",
            name: "notFound",
            component: () => import("./views/notFound")
        }
    ],
    scrollBehavior(to, from, savedPosition) {
        return {
            x: 0,
            y: 0
        };
    }
});
